﻿using System.Windows.Forms;
using DotNet.Common;

namespace DotNet.Common
{
    public partial class ChannelName : DynamicUserControl, IDynamicOperation
    {
        public ChannelName()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 通道名称
        /// </summary>
        public string[] ChannelList
        {
            set
            {
                BoxChannel.Items.Clear();
                if (value != null)
                {
                    BoxChannel.Items.AddRange(value);
                }
            }
        }

        /// <summary>
        /// 编号
        /// </summary>
        public int Num
        {
            set
            {
                labelNum.Text = string.Format("{0}.", value);
            }
        }

        /// <summary>
        /// 通道名称字符串
        /// </summary>
        public string Label
        {
            get
            {
                return BoxChannel.Text;
            }
            set
            {
                BoxChannel.Text = value;
            }
        }

        /// <summary>
        /// 通道名称序号
        /// </summary>
        public int LabelIndex
        {
            set
            {
                if(value < BoxChannel.Items.Count)
                    BoxChannel.SelectedIndex = value;
            }
        }

        public void Empty()
        {
            BoxChannel.SelectedIndex = -1;
        }

//         private void linkLabelAdd_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
//         {
//             this.Add();
//         }
// 
//         private void linkLabelDelete_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
//         {
//             this.Delete();
//         }
    }
}
